package io.renren.modules.quickService.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.quickService.entity.OrderOperationEntity;
import io.renren.modules.quickService.service.OrderOperationService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 订单操作记录表
 *
 * @author zenger380
 *  zenger380@163.com
 *  2018-09-19 16:47:53
 */
@RestController
@RequestMapping("quickService/orderOperation")
public class OrderOperationController {
    @Autowired
    private OrderOperationService orderOperationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("quickService:orderOperation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderOperationService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("quickService:orderOperation:info")
    public R info(@PathVariable("id") Long id){
			OrderOperationEntity orderOperation = orderOperationService.selectById(id);

        return R.ok().put("orderOperation", orderOperation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("quickService:orderOperation:save")
    public R save(@RequestBody OrderOperationEntity orderOperation){
			orderOperationService.insert(orderOperation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("quickService:orderOperation:update")
    public R update(@RequestBody OrderOperationEntity orderOperation){
			orderOperationService.updateById(orderOperation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("quickService:orderOperation:delete")
    public R delete(@RequestBody Long[] ids){
			orderOperationService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
